package com.aurora.source.center.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.aurora.source.R;
import com.aurora.source.base.BaseRecyclerAdapter;
import com.aurora.source.base.CommonHolder;
import com.aurora.source.home.bean.BatchManagementBean;

import butterknife.BindView;

/**
 * @author: ww
 * @description:
 * @date: 2018/10/8
 */
public class BatchListAdapter extends BaseRecyclerAdapter<BatchManagementBean.BatchListBean> {
    @Override
    public CommonHolder<BatchManagementBean.BatchListBean> setViewHolder(ViewGroup parent) {
        return new MyHolder(parent.getContext(),parent);
    }

    public class MyHolder extends CommonHolder<BatchManagementBean.BatchListBean> {

        @BindView(R.id.tv_name)
        TextView tvName;
        @BindView(R.id.tv_number)
        TextView tvNumber;

        public MyHolder(Context context, ViewGroup root) {
            super(context, root, R.layout.item_batch_list);
        }

        @Override
        public void bindData(final BatchManagementBean.BatchListBean data, final int positon) {
            tvName.setText(data.getBatchTitle());
            tvNumber.setText(data.getCreateUserName());
            itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    onItemClickListener.onClick(positon,data);
                }
            });
        }
    }
}
